home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / shells / tcshsrc.zoo / tcsh / tc.vers.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-10  |  11.5 KB  |  445 lines

  1. /* $Header: /home/hyperion/mu/christos/src/sys/tcsh-6.00/RCS/tc.vers.c,v 3.5 1991/08/06 01:50:07 christos Exp $ */
  2. /*
  3.  * tc.vers.c: Version dependent stuff
  4.  */
  5. /*-
  6.  * Copyright (c) 1980, 1991 The Regents of the University of California.
  7.  * All rights reserved.
  8.  *
  9.  * Redistribution and use in source and binary forms, with or without
  10.  * modification, are permitted provided that the following conditions
  11.  * are met:
  12.  * 1. Redistributions of source code must retain the above copyright
  13.  *    notice, this list of conditions and the following disclaimer.
  14.  * 2. Redistributions in binary form must reproduce the above copyright
  15.  *    notice, this list of conditions and the following disclaimer in the
  16.  *    documentation and/or other materials provided with the distribution.
  17.  * 3. All advertising materials mentioning features or use of this software
  18.  *    must display the following acknowledgement:
  19.  *    This product includes software developed by the University of
  20.  *    California, Berkeley and its contributors.
  21.  * 4. Neither the name of the University nor the names of its contributors
  22.  *    may be used to endorse or promote products derived from this software
  23.  *    without specific prior written permission.
  24.  *
  25.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  26.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  27.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  28.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  29.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  30.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  31.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  32.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  33.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  34.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  35.  * SUCH DAMAGE.
  36.  */
  37. #include "config.h"
  38. RCSID("$Id: tc.vers.c,v 3.5 1991/08/06 01:50:07 christos Exp $")
  39.  
  40. #include "sh.h"
  41. #include "patchlevel.h"
  42.  
  43.  
  44. Char *
  45. gethosttype()
  46. {
  47.     Char *hosttype;
  48.     
  49. #ifdef HOSTTYPE    /* Override any system determined hosttypes */
  50.     hosttype = str2short(HOSTTYPE);
  51. #else
  52. # ifdef vax
  53. #  define _havehosttype_
  54.     hosttype = str2short("vax");
  55. # endif /* vax */
  56.  
  57. # ifdef hp9000 /* hp9000 running MORE/bsd */
  58. #  ifdef hp300
  59. #   define _havehosttype_
  60.     hosttype = str2short("hp300");
  61. #  endif 
  62. #  ifdef hp800
  63. #   define _havehosttype_
  64.     hosttype = str2short("hp800");
  65. #  endif 
  66. #  ifndef _havehosttype_
  67. #   define _havehosttype_
  68.     hosttype = str2short("hp9000");    
  69. #  endif 
  70. # endif /* hp9000 */
  71.  
  72. # ifdef sun
  73. #  ifdef mc68010
  74. #   define _havehosttype_
  75.     hosttype = str2short("sun2");
  76. #  endif /* mc68010 */
  77. #  ifdef mc68020
  78. #   define _havehosttype_
  79.     hosttype = str2short("sun3");
  80. #  endif /* mc68020 */
  81. #  ifdef sparc
  82. #   define _havehosttype_
  83.     hosttype = str2short("sun4");
  84. #  endif /* sparc */
  85. #  ifdef i386
  86. #   define _havehosttype_
  87.     hosttype = str2short("sun386i");
  88. #  endif /* i386 */
  89. #  ifndef _havehosttype_
  90. #   define _havehosttype_
  91.     hosttype = str2short("sun");    
  92. #  endif 
  93. # endif /* sun */
  94.  
  95. # ifdef pyr /* pyramid */
  96. #  define _havehosttype_
  97.     hosttype = str2short("pyramid");
  98. # endif /* pyr */
  99.  
  100. # ifdef ibm032 /* from Jak Kirman */
  101. #  define _havehosttype_
  102.     hosttype = str2short("rt");
  103. # endif /* ibm032 */
  104.  
  105. # ifdef aiws /* not to be confused with the above */
  106. #  define _havehosttype_
  107.     hosttype = str2short("rtpc");
  108. # endif /* aiws */
  109.  
  110. # ifdef _AIX370
  111. #  define _havehosttype_
  112.     hosttype = str2short("aix370");
  113. # endif /* _AIX370 */
  114.  
  115. # ifdef _IBMR2
  116. #  define _havehosttype_
  117.     hosttype = str2short("rs6000");
  118. # endif /* _IBMR2 */
  119.  
  120. # ifdef _AIXPS2 /* AIX on a PS/2 */
  121. #  define _havehosttype_
  122.     hosttype = str2short("ps2");
  123. # endif /* _AIXPS2 */
  124.  
  125. # ifdef OREO
  126. #  define _havehosttype_
  127.     hosttype = str2short("mac2");
  128. # endif /* OREO */
  129.  
  130. # ifdef hpux
  131. #  if defined(__hp9000s700) && !defined(_havehosttype_)
  132. #   define _havehosttype_
  133.    hosttype = str2short("hp9000s700");
  134. #  endif /* __hp9000s700 */
  135. #  if defined(hp9000s800) && !defined(_havehosttype_)
  136. #   define _havehosttype_
  137.    hosttype = str2short("hp9000s800");    /* maybe "spectrum" */
  138. #  endif /* hp9000s800 */
  139. #  if defined(hp9000s300) && !defined(_havehosttype_)
  140. #   define _havehosttype_
  141.    hosttype = str2short("hp9000s300");
  142. #  endif /* hp9000s300 */
  143. #  ifndef _havehosttype_
  144. # if defined(hp9000s500) && !defined(_havehosttype_)
  145. #  define _havehosttype_
  146.    hosttype = str2short("hp9000s500");
  147. # endif /* hp9000s500 */
  148. #   define _havehosttype_
  149.    hosttype = str2short("hp");
  150. #  endif /* _havehosttype_ */
  151. # endif /* hpux */
  152.  
  153. # ifdef apollo
  154. #  define _havehosttype_
  155.     hosttype = str2short("apollo");
  156. # endif 
  157.  
  158. # ifdef u3b20d
  159. #  define _havehosttype_
  160.     hosttype = str2short("att3b20");
  161. # endif /* u3b20d */
  162.  
  163. # ifdef u3b15
  164. #  define _havehosttype_
  165.     hosttype = str2short("att3b15");
  166. # endif /* u3b15 */
  167.  
  168. # ifdef u3b5
  169. #  define _havehosttype_
  170.     hosttype = str2short("att3b5");
  171. # endif /* u3b5 */
  172.  
  173. # ifdef u3b2
  174. #  define _havehosttype_
  175.     hosttype = str2short("att3b2");
  176. # endif /* u3b2 */
  177.  
  178. # if defined(i386) && SVID > 0
  179.  
  180. #  if !defined(_havehosttype_) && (defined(ISC) || defined(ISC202))
  181. #   define _havehosttype_
  182.     hosttype = str2short("isc386");
  183. #  endif /* !_havehosttype_ && (ISC || ISC202) */
  184.  
  185. #  if !defined(_havehosttype_) && defined(SCO)
  186. #   define _havehosttype_
  187.     hosttype = str2short("sco386");
  188. #  endif /* !_havehosttype_ && SCO */
  189.  
  190. #  if !defined(_havehosttype_) && defined(INTEL)
  191. #   define _havehosttype_
  192.     hosttype = str2short("intel386");
  193. #  endif /* !_havehosttype_ && INTEL */
  194.  
  195. #  ifndef _havehosttype_
  196. #   define _havehosttype_
  197.     hosttype = str2short("i386");
  198. #  endif /* _havehosttype_ */
  199.  
  200. # endif 
  201.  
  202. #ifdef UNIXPC
  203. # define _havehosttype_
  204.     hosttype = str2short("unixpc");
  205. #endif /* UNIXPC/att3b1/att7300 */
  206.  
  207. # ifdef alliant
  208. #  define _havehosttype_
  209.     hosttype = str2short("alliant");    /* for Alliant FX Series */
  210. # endif 
  211.  
  212. # if defined(i386) && defined(MACH)
  213. #  define _havehosttype_
  214.     hosttype = str2short("i386-mach");
  215. # endif 
  216.  
  217. # if defined(sequent) || defined(_SEQUENT_)
  218. #  define _havehosttype_
  219. #  ifdef i386
  220. #   ifdef sequent
  221.     hosttype = str2short("symmetry");    /* Sequent Symmetry Dynix/3 */
  222. #    ifndef LOCALSTR
  223. #     define LOCALSTR    " (Dynix/3)"
  224. #    endif /* LOCALSTR */
  225. #   else
  226.     hosttype = str2short("ptx");    /* Sequent Symmetry Dynix/ptx */
  227. #    ifndef LOCALSTR
  228. #     define LOCALSTR    " (Dynix/ptx)"
  229. #    endif /* LOCALSTR */
  230. #   endif 
  231. #  else
  232.     hosttype = str2short("balance");    /* for Sequent Balance Series */
  233. #   ifndef LOCALSTR
  234. #    define LOCALSTR    " (Dynix/3)"
  235. #   endif /* LOCALSTR */
  236. #  endif 
  237. # else /* !sequent */
  238. #  ifdef ns32000
  239. #   define _havehosttype_
  240. #   ifdef CMUCS            /* hack for Mach (in the true spirit of CMU) */
  241.     hosttype = str2short("multimax");
  242. #   else /* CMUCS */
  243.     hosttype = str2short((!access("/Umax.image", F_OK) ? 
  244.              "multimax" : "ns32000"));
  245. #   endif /* CMUCS */
  246. #  endif /* ns32000 */
  247. # endif /* sequent */
  248.  
  249. # if defined(convex) || defined(__convex__)
  250. #  define _havehosttype_
  251.     /* From: Brian Allison <uiucdcs!convex!allison@RUTGERS.EDU> */
  252.     hosttype = str2short("convex");
  253. # endif /* convex */
  254.  
  255. # ifdef butterfly
  256. #  define _havehosttype_
  257.     /* this will work _until_ the bfly with 88000s comes out */
  258.     hosttype = str2short("butterfly");    /* BBN Butterfly 1000 */
  259. # endif /* butterfly */
  260.  
  261. # ifdef NeXT
  262. #  define _havehosttype_
  263.     hosttype = str2short("next");
  264. # endif /* NeXT */
  265.  
  266. /* From Kazuhiro Honda <honda@mt.cs.keio.ac.jp> */
  267. # ifdef sony_news
  268. #  define _havehosttype_
  269. #  ifdef mips /* Sony NEWS based on a r3000 */
  270.     hosttype = str2short("news_mips");
  271. #  else
  272.     hosttype = str2short("news");
  273. #  endif 
  274. # endif /* sony_news */
  275.  
  276. # ifdef mips
  277. #  define _havehosttype_
  278. #  ifdef MIPSEL
  279. #   ifdef ultrix
  280.     hosttype = str2short("decstation");
  281. #   else
  282.     hosttype = str2short("mips");
  283. #   endif /* ultrix */
  284. #  endif /* MIPSEL */
  285. #  ifdef MIPSEB
  286. #   ifdef ultrix
  287.     hosttype = str2short("decmips");
  288. #   else
  289. #    ifdef sgi /* sgi iris 4d */
  290.     hosttype = str2short("iris4d");
  291. #    else
  292. #     ifdef sony_news
  293.     hosttype = str2short("news_mips");
  294. #     else
  295.     hosttype = str2short("mips");
  296. #     endif /* sony_news */
  297. #    endif /* sgi */
  298. #   endif /* ultrix */
  299. #  endif /* MIPSEB */
  300. # endif /* mips */
  301.  
  302. # ifdef m88k
  303. #  define _havehosttype_
  304.     hosttype = str2short("m88k");    /* Motorola 88100 system */
  305. # endif 
  306.  
  307. # ifdef masscomp            /* Added, DAS DEC-90. */
  308. #  define _havehosttype_
  309.     hosttype = str2short("masscomp");/* masscomp == concurrent */
  310. # endif /* masscomp */
  311.  
  312. # ifdef GOULD_NP1
  313. #  define _havehosttype_
  314.     hosttype = str2short("gould_np1");
  315. # endif /* GOULD_NP1 */
  316.  
  317. # ifdef SXA
  318. #  define _havehosttype_
  319.     hosttype = str2short("pfa50");
  320. #  ifdef  _BSDX_
  321. #   ifndef LOCALSTR
  322. #    define LOCALSTR    " (SX/A E60+BSDX)"
  323. #   endif /* LOCALSTR */
  324. #  else
  325. #   ifndef LOCALSTR
  326. #    define LOCALSTR    " (SX/A E60)"
  327. #   endif /* LOCALSTR */
  328. #  endif 
  329. # endif /* PFU/Fujitsu A-xx computer */
  330.  
  331. # ifdef titan
  332. #  define _havehosttype_
  333.     /* Ken Laprade <laprade@trantor.harris-atd.com> */
  334.     hosttype = str2short("titan");
  335. # endif /* titan */
  336.  
  337. # ifdef sgi
  338. /* Iris 4D is in the mips section; these are the 68k machines. */
  339. #  ifdef m68000
  340. #   define _havehosttype_
  341.     /* Vince Del Vecchio <vd09@andrew.cmu.edu> */
  342.     hosttype = str2short("iris3d");
  343. #  endif
  344. # endif /* sgi */
  345.  
  346. #ifdef uts
  347. # define _havehosttype_
  348.     hosttype = str2short("amdahl");
  349. #endif /* uts */
  350.   
  351. # ifdef atarist
  352. #  define _havehosttype_
  353.     hosttype = str2short("atarist");
  354. # endif
  355.  
  356. # ifndef _havehosttype_
  357. #  define _havehosttype_
  358.     /* Default to something reasonable */
  359.     hosttype = str2short("unknown");
  360. # endif 
  361. # undef _havehosttype_
  362. #endif /* HOSTTYPE */
  363.     return hosttype;
  364. } /* end gethosttype */
  365.  
  366.  
  367. /* fix_version():
  368.  *    Print a reasonable version string, printing all compile time
  369.  *    options that might affect the user.
  370.  */
  371. void
  372. fix_version()
  373. {
  374.     char    version[BUFSIZ];
  375.  
  376. #ifdef SHORT_STRINGS
  377. # define SSSTR "8b"
  378. #else
  379. # define SSSTR "7b"
  380. #endif 
  381. #ifdef NLS
  382. # define NLSSTR ",nls"
  383. #else
  384. # define NLSSTR ""
  385. #endif 
  386. #ifdef LOGINFIRST
  387. # define LFSTR ",lf"
  388. #else
  389. # define LFSTR ""
  390. #endif 
  391. #ifdef DOTLAST
  392. # define DLSTR ",dl"
  393. #else
  394. # define DLSTR ""
  395. #endif 
  396. #ifdef VIDEFAULT
  397. # define VISTR ",vi"
  398. #else
  399. # define VISTR ""
  400. #endif 
  401. #ifdef TESLA
  402. # define DTRSTR ",dtr"
  403. #else
  404. # define DTRSTR ""
  405. #endif 
  406. #ifdef KAI
  407. # define BYESTR ",bye"
  408. #else
  409. # define BYESTR ""
  410. #endif 
  411. #ifdef AUTOLOGOUT
  412. # define ALSTR ",al"
  413. #else
  414. # define ALSTR ""
  415. #endif 
  416. #ifdef CSHDIRS
  417. # define DIRSTR ",dir"
  418. #else
  419. # define DIRSTR ""
  420. #endif 
  421. #ifdef KANJI
  422. # define KANSTR ",kan"
  423. #else
  424. # define KANSTR ""
  425. #endif 
  426. #ifdef SYSMALLOC
  427. # define SMSTR    ",sm"
  428. #else
  429. # define SMSTR  ""
  430. #endif 
  431. /* if you want your local version to say something */
  432. #ifndef LOCALSTR
  433. # define LOCALSTR ""
  434. #endif /* LOCALSTR */
  435.  
  436.     xsprintf(version,
  437.            "tcsh %d.%.2d.%.2d (%s) %s options %s%s%s%s%s%s%s%s%s%s%s%s",
  438.            REV, VERS, PATCHLEVEL, ORIGIN, DATE,
  439.            SSSTR, NLSSTR, LFSTR, DLSTR, VISTR, DTRSTR,
  440.            BYESTR, ALSTR, DIRSTR, KANSTR, SMSTR, LOCALSTR);
  441.     set(STRversion, SAVE(version));
  442.     xsprintf(version, "%d.%.2d.%.2d", REV, VERS, PATCHLEVEL);
  443.     set(STRtcsh, SAVE(version));
  444. }
  445.